extends ../layout

block content
  .pb-2.mt-2.mb-4.border-bottom
    h2
      i.fab.fa-paypal.fa-sm.me-2(style='color: #1b4a7d')
      | PayPal API
  .btn-group.d-flex(role='group')
    a.btn.btn-primary.w-100(href='https://developer.paypal.com/docs/checkout/', target='_blank')
      i.far.fa-check-square.fa-sm.me-2
      | Checkout API
    a.btn.btn-primary.w-100(href='https://developer.paypal.com/docs/api/orders/v2/', target='_blank')
      i.fas.fa-code.fa-sm.me-2
      | Payments API
  h3 Sample Payment
  if result
    if canceled
      h4 Payment was canceled!
    if success
      h4 Payment was executed successfully!
    else
      h4 There was an error processing the payment.
    a(href='/api/paypal')
      button.btn.btn-primary New Payment
  else
    div
      p Redirects to PayPal and allows authorizing the sample payment.
      h4 Purchase Details:
      ul
        li
          strong Description:
          | #{ purchaseInfo.description }
        li
          strong Currency:
          | #{ purchaseInfo.amount.currency_code }
        li
          strong Amount:
          | #{ purchaseInfo.amount.value }
      a(href=approvalUrl)
        button.btn.btn-primary Authorize Payment
